from rest_framework import serializers

from areas.models import Areas

#获取省级地区信息接口
class AreasSerializer(serializers.ModelSerializer):
    class Meta:
        model = Areas
        fields = ('id','name')

# class AreasCitySerializer(serializers.ModelSerializer):
#     subs = AreasSerializer(label='下级地区',many=True)
#     class Meta:
#         model = Areas
#         fields = ('id','name','subs')

class AreasCitySerializer(serializers.ModelSerializer):
    subs = AreasSerializer(label='下级地区',many=True)
    class Meta:
        model = Areas
        fields = ('id','name','subs')